// LaserCodeUserDefMaxRateDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Lightning.h"
#include "LaserCodeUserDefMaxRateDlg.h"
#include "afxdialogex.h"


// CLaserCodeUserDefMaxRateDlg dialog

IMPLEMENT_DYNAMIC(CLaserCodeUserDefMaxRateDlg, CDialogEx)

CLaserCodeUserDefMaxRateDlg::CLaserCodeUserDefMaxRateDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(CLaserCodeUserDefMaxRateDlg::IDD, pParent)
{
	m_nMaxRate = 16;
}

CLaserCodeUserDefMaxRateDlg::~CLaserCodeUserDefMaxRateDlg()
{
}

void CLaserCodeUserDefMaxRateDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CLaserCodeUserDefMaxRateDlg, CDialogEx)
	ON_BN_CLICKED(IDC_BTN_OK, &CLaserCodeUserDefMaxRateDlg::OnBnClickedBtnOk)
	ON_BN_CLICKED(IDC_BTN_CANCLE, &CLaserCodeUserDefMaxRateDlg::OnBnClickedBtnCancle)
END_MESSAGE_MAP()


// CLaserCodeUserDefMaxRateDlg message handlers


BOOL CLaserCodeUserDefMaxRateDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  Add extra initialization here
	SetDlgItemInt(IDC_EDIT_USERDEF_MAX_RATE, m_nMaxRate);
	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}


BOOL CLaserCodeUserDefMaxRateDlg::PreTranslateMessage(MSG* pMsg)
{
	// TODO: Add your specialized code here and/or call the base class
	if (pMsg->message == WM_KEYDOWN)
	{
		if (pMsg->wParam == VK_RETURN)
		{
			return TRUE;
		}
	}
	return CDialogEx::PreTranslateMessage(pMsg);
}


void CLaserCodeUserDefMaxRateDlg::OnBnClickedBtnOk()
{
	// TODO: Add your control notification handler code here
	CString str;
	GetDlgItemText(IDC_EDIT_USERDEF_MAX_RATE, str);
	m_nMaxRate = _wtol(str);
	CDialogEx::OnOK();
}


void CLaserCodeUserDefMaxRateDlg::OnBnClickedBtnCancle()
{
	// TODO: Add your control notification handler code here
	CDialogEx::OnCancel();
}
